<?php


namespace App\Controller;


use App\Base\ErrCode;
use App\Base\Response;
use App\Logic\BlessLogic;

class Bless
{
    use Response;

    /**
     * 留言
     */
    public function leaveBless()
    {
        $param = myTrim($_REQUEST);

        if (empty($param['bless'])) {
            self::returnJson(ErrCode::$failCode, [], '留言内容不能为空');
        }

        self::returnJson(...(new BlessLogic())->leaveMessage($param));
    }

    /**
     * 获取列表
     */
    public function blessList()
    {
        $param = myTrim($_REQUEST);
        self::returnJson(ErrCode::$successCode, (new BlessLogic())->msgList($param), '获取列表成功');
    }

    /**
     * 获取点赞排行榜单
     */
    public function blessRankList()
    {
        self::returnJson(ErrCode::$successCode, (new BlessLogic())->msgRankList(), '获取排行榜成功');
    }

    /**
     * 点赞
     */
    public function likeBless()
    {
        $param = myTrim($_REQUEST);
        self::returnJson(...(new BlessLogic())->likeBless($param));
    }
}